﻿//06.You are given a sequence of positive integer values written into a string, separated by spaces. Write a function that reads these values from given string and calculates their sum.
//Example: string = "43 68 9 23 318" -> result = 461

using System;
using System.Collections.Generic;

namespace PrintSum
{
    class PrintSum
    {
        static void Main()
        {
            Console.Write("Enter your numbers: ");
            string input = Console.ReadLine();
            string[] numbers = input.Split(' ');

            int sum = 0;

            foreach (string number in numbers)
            {
                sum += int.Parse(number);
            }

            Console.WriteLine("The sum is: {0}.", sum);
        }
    }
}
